﻿using System;

using Microsoft.VisualStudio.Package;
using Microsoft.WowAddonStudio.Lua.LanguageService.Intellisense;
using Microsoft.WowAddonStudio.Lua.LanguageService.Model;
using Microsoft.WowAddonStudio.Lua.Parser;

using NUnit.Framework;

namespace Microsoft.WowAddonStudio.Lua.LanguageService.Tests.Intellisense
{
    [TestFixture]
    public class DeclarationProviderTestBase<TDeclarationProvider> where TDeclarationProvider : IDeclarationProvider
    {
        protected TDeclarationProvider declarationProvider;

        [SetUp]
        public void SetUp()
        {
            declarationProvider = this.CreateDeclarationProvider();
        }

        public virtual TDeclarationProvider CreateDeclarationProvider()
        {
            return Activator.CreateInstance<TDeclarationProvider>();
        }

        protected LuaParseRequest CreateParseRequest(ParseReason parseReason, int line, int column)
        {
            var parseRequest = new LuaParseRequest(line, column, new TokenInfo(), String.Empty, String.Empty, parseReason, null, new LuaAuthoringSink(parseReason, line, column, 30), true);
            parseRequest.Sink.EnsureParserSink<QualifiedNameParserSink>();
            return parseRequest;
        }
    }
}
